package com.cndw.kungfu.vo;

import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.cndw.kungfu.domain.Mail;
import com.cndw.kungfu.vo.goodsvo.GoodsVO;
import com.cndw.kungfu.vo.goodsvo.SubPopsVO;

/**
 * 玩家信件vo
 * @author fantadust
 * @date 2011-5-13 下午03:07:29
 */
public class MailVO {
	public int id;
	public long playerId;//收件人
	public String playerName;//名称
	public long senderId;//发件人
	public String senderName;//发件人名称
	public String title;//标题
	public String content;//内容
	public int addTime;
	public int type;//类型
	public boolean saved;//是否保存
	public boolean readed;//是否已读
	public int status;//状态
	public boolean hasAttachment;
	public int getTime;
	public int asset;//附加银两
	public int exp;//附加经验
	public List<GoodsVO> goods;
	
	
	public MailVO(Mail mail) {
		id = mail.getId();
		playerId = mail.getPlayerId();
		playerName = mail.getPlayerName();
		senderId = mail.getSenderId();
		senderName = mail.getSenderName();
		title = mail.getTitle();
		content = mail.getContent();
		addTime = mail.getAddTime();
		type = mail.getType();
		saved = mail.isSaved();
		readed = mail.isReaded();
		status = mail.getStatus();	
		hasAttachment = !StringUtils.isBlank(mail.getAttachment());
		getTime = mail.getGetTime();
	}
	
	public MailVO(Mail mail,List<GoodsVO> goodsList) {
		this(mail);
		this.goods = goodsList;
	}
	
	public MailVO(Mail mail, SubPopsVO subPopsVO){
		this(mail);
		if(subPopsVO != null){
			this.goods = subPopsVO.getGoodsList();
			this.asset = subPopsVO.getAsset();
			this.exp = subPopsVO.getExp();
		}
	}
}
